﻿using System;
using System.Globalization;
using System.Threading;

namespace MMD_Morph_NoteHelp
{
    public static class LanguageManager
    {
        // 静态事件：所有窗口订阅此事件以接收语言变更通知
        public static event Action OnLanguageChanged;

        // 切换语言并通知所有窗口更新
        public static void SetLanguage(string cultureName)
        {
            var culture = new CultureInfo(cultureName);
            Thread.CurrentThread.CurrentUICulture = culture;
            Thread.CurrentThread.CurrentCulture = culture; // 可选：同步地区格式

            // 触发事件，通知所有订阅的窗口更新语言
            OnLanguageChanged?.Invoke();
        }
    }
}